@extends('admin.layout')

@section('content')
    <body class="hold-transition skin-blue sidebar-mini">
    <!-- Content Wrapper. Contains page content -->
    <div class="content-wrapper">
        <!-- Content Header (Page header) -->
        <section>
            <ol class="breadcrumb">
                <li><a href="#"><i class="fa fa-dashboard"></i> 首页</a></li>
                <li><a href="#">会员管理</a></li>
                <li><a href="#">会员列表</a></li>
                <li class="active">修改会员信息</li>
            </ol>
        </section>
        <!-- Main content -->
        <section class="content">
            <div class="row">
                <!-- left column -->
                <div class="col-md-12" style="width: 100%;">
                    <!-- general form elements -->
                    <div class="box box-primary">
                        <div class="box-header with-border">
                            <h3 class="box-title"></h3>
                        </div>
                        <!-- /.box-header -->
                        <span id="msg" style="display: none">
                            @if (count($errors) > 0)
                                @foreach ($errors->all() as $error)
                                    <div style="width: 100%;">
                                        <span style="color: red;display: block;margin: 0px auto;width: 200px;text-align: center;">{{ $error }}</span>
                                    </div>
                                @endforeach
                            @endif
                        </span>
                        <script type="text/javascript">
                            var _msg = $('#msg div span').text();
                            console.log(_msg);
                            if(_msg != ''){
                                layer.msg(_msg);
                            }
                        </script>
                        <!-- form start -->
                            <form  action="{{ url('admin/updateUser') }}" method="post">
                                {{ csrf_field() }}
                                <input type="hidden" value="{{ $value['id'] }}" name="uid">
                                <div class="box-body" style="width: 50%;">
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">会员名称</label>
                                        <input type="text" name="name" class="form-control" placeholder="名称" value="{{ $value['name'] }}" readonly>
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">性别:</label>
                                        @if($value['sex'] === '0')
                                            <input type="radio" name="sex" value="0" style="margin-left: 200px;" checked="checked"><span style="margin-left: 10px;" >男</span>
                                            <input type="radio" name="sex" value="1" style="margin-left: 150px;"><span style="margin-left: 10px;">女</span>
                                        @elseif($value['sex'] === '1')
                                            <input type="radio" name="sex" value="0" style="margin-left: 200px;"><span style="margin-left: 10px;" >男</span>
                                            <input type="radio" name="sex" value="1" style="margin-left: 150px;" checked="checked"><span style="margin-left: 10px;" >女</span>
                                        @else
                                            <input type="radio" name="sex" value="0" style="margin-left: 200px;"><span style="margin-left: 10px;">男</span>
                                            <input type="radio" name="sex" value="1" style="margin-left: 150px;"><span style="margin-left: 10px;">女</span>
                                        @endif
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">车牌号</label>
                                        <input type="text" name="car_num" class="form-control" id="exampleInputEmail1" placeholder="车牌号" required value="{{ $value['car_num'] }}">
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">会员积分</label>
                                        <input type="text" name="integral" class="form-control" id="exampleInputEmail1" placeholder="会员积分" value="{{ $value['integral'] }}">
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">会员邮箱</label>
                                        <input type="text" name="email" class="form-control" id="exampleInputEmail1" placeholder="email" value="{{ $value['email'] }}">
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">会员电话</label>
                                        <input type="text" name="phone" class="form-control" id="phone " placeholder="手机号" required value="{{ $value['phone'] }}">
                                    </div>
                                    <div class="form-group">
                                        <label for="exampleInputEmail1">会员地址</label>
                                        <textarea rows="4" name="address" class="form-control" placeholder="地址">{{ $value['address'] }}</textarea>
                                    </div>
                                    <div>
                                        <label>客户经理</label>
                                        <select style="width: 150px"  name="mid" class="form-control">
                                            <option value="{{ $value['mid'] }}">{{ App\Manage::find($value['mid'])['username'] }}</option>
                                            @foreach($man as $v)
                                                <option value="{{ $v['id'] }}">{{ $v['username'] }}</option>
                                            @endforeach
                                        </select>
                                    </div>

                                </div>
                                <!-- /.box-body -->

                                <div class="box-footer">
                                    <button type="submit" class="btn btn-primary">提交客户</button>
                                </div>
                            </form>
                    </div>
                    <!-- /.box -->

                </div>

                <!--/.col (right) -->
            </div>
            <!-- /.row -->
        </section>
        <!-- /.content -->
    </div>
    <!-- /.content-wrapper -->
@stop
